<div class="modal-header"><button aria-hidden="true" data-dismiss="modal" class="close" type="button">×</button></div>
<div class="modal-body form-horizontal tab-content">
<ul class="nav nav-tabs" style="margin-top:-28px">
	<li ng-repeat="tab in modaldata.tabs" ng-class="{'active':modaldata.op==tab.op}"><a href="javascript:;" ng-click="modaldata.op=tab.op">{{tab.title}}</a></li>
</ul>
<div ng-show="modaldata.op=='local'" style="margin-top:15px">
	<div class="form-group">
		<label class="col-xs-12 col-sm-3 col-md-2 left-label">选择上传</label>
		<div ng-if="modaldata.type!='more'" class="col-sm-8">
			<div class="input-group">
				<input type="text" class="form-control " placeholder=""  ng-model="modaldata.image" readonly="readonly" />
				<span class="input-group-btn">
					<button class="btn btn-primary" type="button" ng-click="up_file(modaldata,'image',modaldata.source_type)"><i class="fa fa-external-link"></i> 选择上传</button>
				</span>
				
			</div>
			<div class="input-group" style="margin-top:.5em;" ng-if="modaldata.source_type=='image'">
				<img ng-src="{{tomedia(modaldata.image) || '../core/resource/images/nopic.jpg'}}" class="img-responsive img-thumbnail" width="150" />
			</div>
			<span class="help-block" ></span>
		</div>
		<div ng-if="modaldata.type=='more'" class="col-sm-8">
			<div class="input-group" ng-init="modaldata.image_list=[]">
				<input type="text" class="form-control " placeholder="" readonly="readonly" />
				<span class="input-group-btn">
					<button class="btn btn-primary" type="button" ng-click="up_file(modaldata,'image_list',modaldata.source_type,true)"><i class="fa fa-external-link"></i> 选择上传</button>
				</span>				
			</div>
			<div class="input-group multi-img-details">
					<div class="multi-item" ng-repeat="image in modaldata.image_list">
						<img ng-src="{{tomedia(image) || '../core/resource/images/nopic.jpg'}}" class="img-responsive img-thumbnail">
						<em class="close" title="删除这张图片" ng-click="modaldata.image_list.splice($index,1)">×</em>
					</div>
				</div>
			<span class="help-block" ></span>
		</div>
	</div>
</div>

<div ng-show="modaldata.op=='remote'"  style="margin-top:15px">
	<div class="form-group">
		<label class="col-xs-12 col-sm-3 col-md-2 left-label">填写远程地址</label>
		<div class="col-xs-12 col-sm-8 col-lg-9">
			<input type="text" class="form-control " ng-model="modaldata.url" />
			<div class="help-block">输入{{modaldata.typename}}地址</div>
		</div>
	</div>
</div>
<div ng-show="modaldata.op=='srcurl'"  style="margin-top:15px">
	<div class="form-group">
		<label class="col-xs-12 col-sm-3 col-md-2 left-label">填写远程地址</label>
		<div class="col-xs-12 col-sm-8 col-lg-9">
			<input type="text" class="form-control " ng-model="modaldata.url" />
			<div class="help-block">输入{{modaldata.typename}}地址，直接保存远程地址，不提取！</div>
		</div>
	</div>
</div>
<div ng-show="modaldata.op=='list'" style="margin-top:15px">
<div class="keyword-list-head">
	<div class="keyword-list-head clearfix">
		<div class="input-group jinyun-margin-bottom" style="width:465px;">
			<input class="form-control" type="text" ng-model="modaldata.params.title" value="" placeholder="输入素材名称" style="width: 427px;">
			<span class="input-group-btn"><button id="submit" ng-click="modaldata.params.page=1;getmodal(modal,modaldata.op,made_query(modaldata.params))" class="btn btn-primary"><i class="fa fa-search"></i> 搜索</button></span>
		</div>
	</div>
</div>
<div class="clearfix">
<div class="form-group">
	<div class="btn-group site-tp-group">
		<a href="" ng-repeat="group in modaldata.groups" ng-class="{'btn': 1,'active': modaldata.params.group_id == group.id}" ng-click="modaldata.params.page=1;modaldata.params.group_id=group.id;getmodal(modal,modaldata.op,made_query(modaldata.params))">{{group.title}}</a>
	</div>
</div>
<div class="upimage" ng-if="modaldata.source_type=='image'">
  <div class="inner_container_box side_r cell_layout">
    <div class="inner_main">
      <div class="bd">
        <div class="media_list">
			<div style="padding-right:20px;" ng-include="sys_html('common/modal_page',true)"></div>
			<div class="group img_pick" id="js_imglist">
            <ul class="group">
              <li class="img_item js_imgitem" ng-repeat="item in modaldata.list">
                <div class="img_item_bd" ng-click="choose_image(item.attachment)">
                  <span class="js_img_icon pic cover" style="background-image:url({{tomedia(item.attachment) || '../core/resource/images/nopic.jpg'}})"></span>
                  <span class="check_content t-c">
                    <label class="frm_checkbox_label">
						<input type="checkbox" style="margin-top:-24px;" ng-checked="modaldata.images.indexOf(';'+item.attachment+';')>=0">
						<span class="lbl_content">{{item.title}}</span>
					</label>
                  </span>
                </div>
                
              </li>
         
            </ul>
          </div>
		</div>
      </div>
    </div>
</div>
</div>
<div class="upimage" ng-if="modaldata.source_type=='audio'">
  <div class="inner_container_box side_r cell_layout">
    <div class="inner_main">
      <div class="bd">
        <div class="media_list">
			<div style="padding-right:20px;" ng-include="sys_html('common/modal_page',true)"></div>
			<div class="msg_card audio_msg_card media_card mini no_opr_border" ng-repeat="item in modaldata.list">
				<div class="msg_card_inner" >
				  <div class="msg_card_bd">
					<div  class="audio_msg_wrp card file_wrp cover" ng-click="choose_image(item.attachment)">
					  <div class="audio_msg">
						<div class="icon_audio_wrp l" data-attach="{{tomedia(item.attachment)}}">
						  <span class="icon_audio_msg"> <img src="/core/resource/images/ico-audio.png" width="60px"></img></span>
						</div>
						<div class="audio_content">
						  <div class="audio_title" style="margin-right:10px">{{item.title}}</div>
						  <div class="audio_title" style="margin-right:10px">{{item.attachment}}</div>
						</div>
					  </div>
					</div>
				  </div>
				  <div class="msg_card_ft">
					<ul class="grid_line msg_card_opr_list">
					  <li class="grid_item size-1of3 msg_card_opr_item">
						<a class="js_edit js_tooltip" id="{{item.id}}" href="javascript:;" ng-click="play(item.attachment,item.id)" title="播放">
						  <span class="msg_card_opr_item_inner">
							<i class="fa fa-play-circle-o ico-add"></i></span>
						  <span class="vm_box"></span>
						</a>
					  </li>
					</ul>
				  </div>
				</div>
			</div>	
		</div>
      </div>
    </div>
</div>
</div>
<div class="upimage" ng-if="modaldata.source_type=='video'">
  <div class="inner_container_box side_r cell_layout">
    <div class="inner_main">
      <div class="bd">
        <div class="media_list">
			<div style="padding-right:20px;" ng-include="sys_html('common/modal_page',true)"></div>
			<div class="group img_pick" id="js_imglist">
            <ul class="group">
              <li class="img_item js_imgitem" ng-repeat="item in modaldata.list">
                <div class="img_item_bd" >
                  <span class="js_img_icon pic cover"><video src="{{tomedia(item.attachment)}}" width="150" height="100" controls="controls"></video></span>
                  <span class="check_content t-c" ng-click="choose_image(item.attachment)">
                    <label class="frm_checkbox_label">
						<input type="checkbox" style="margin-top:-24px;" ng-checked="modaldata.images.indexOf(';'+item.attachment+';')>=0">
						<span class="lbl_content" >{{item.title}}</span>
					</label>
                  </span>
                </div>
                
              </li>
         
            </ul>
          </div>
		</div>
      </div>
    </div>
</div>
</div>
</div>
</div>

</div>
<div class="modal-footer" ng-if="modaldata.op=='local' && modaldata.type!='more'"><a href="javascript:;" class="btn btn-primary" ng-click="modal_result(modaldata.image)">确定</a></div>
<div class="modal-footer" ng-if="modaldata.op=='local' && modaldata.type=='more'"><a href="javascript:;" class="btn btn-primary" ng-click="modaldata.modal_result(modaldata.image_list)">确定</a></div>
<div class="modal-footer" ng-if="modaldata.op=='remote'"><a href="javascript:;" class="btn btn-primary" ng-click="remote_up(modaldata.url)">确定</a></div>
<div class="modal-footer" ng-if="modaldata.op=='srcurl'"><a href="javascript:;" class="btn btn-primary" ng-click="set_srcurl(modaldata.url)">确定</a></div>
<div class="modal-footer" ng-if="modaldata.op=='list' && modaldata.type=='more'"><a href="javascript:;" class="btn btn-primary" ng-click="modal_result(modaldata.images)">确定</a></div>
<script>
	scope.remote_up=function(url){
		var data={'url':url,'type':scope.modaldata.source_type};
		var post={'data':data,'plugin':'core','action':'tools.file_upload','op':'remote'};
		post.callback=function(res){
			scope.modal_result(res);
			scope.$apply();
		}
		scope.post_json(post);
	}
	scope.set_srcurl=function(url){
		if(url){
			scope.modal_result(url);
		}
	}
	scope.modaldata.modal_result=function(images){
		var res=';'+images.join(';')+';';
		scope.modal_result(res);
	}
	scope.choose_image=function(image){
		if(scope.modaldata.type=='more'){
			scope.duoxuans(image,scope.modaldata,'images');
		}else{
			scope.modal_result(image);
		}
	}
</script>